package nc.impl.hrkq.leave.ext;

import java.io.File;
import java.io.InputStream;
import java.util.Map;

import nc.bs.hrkq.leave.op.ExcelImportBp;
import nc.bs.krkq.bg.TripBg;
import nc.itf.hrkq.leave.ext.IHrkqExtServer;
import nc.itf.hrkq.vo.TripMidVO;
import nc.vo.pub.BusinessException;

public class HrkqExtServer implements IHrkqExtServer {
	
	private ExcelImportBp excelBp = null;
	
	public ExcelImportBp getExcelBp() {
		if(excelBp == null) excelBp = new ExcelImportBp();
		return excelBp;
	}

	@Override
	public void importLeaveExl(String sessionid, InputStream fileInput, String fileName) throws BusinessException {
		getExcelBp().exec(sessionid, fileInput, fileName);
	}

	@Override
	public void importLeave__RequiresNew(String sessionid, Map<String, Object> map, String billType,
			StringBuffer errMes) throws BusinessException {
		getExcelBp().exec_Single(sessionid, map, billType, errMes);
	}

	@Override
	public void importTrip__RequiresNew(TripMidVO vo, String sessionid, String cuserid, String psnid) throws BusinessException {
		new TripBg().importTrip_TZ(vo, sessionid, cuserid, psnid);
	}

	@Override
	public int checkLeaveExl(String sessionid, InputStream fileInput, String fileName) throws BusinessException {
		return getExcelBp().check(sessionid, fileInput, fileName);
	}

	@Override
	public String importLeaveExl(String sessionid, int total) throws Exception {
		return getExcelBp().importLeaveExl(sessionid, total);
	}

	@Override
	public File importResultLeaveExl(String sessionid) throws BusinessException {
		return getExcelBp().downLoadResult(sessionid);
	}

	@Override
	public void updateMessage__RequiresNew(String sessionid, int sortNum, String result) {
		getExcelBp().updateMessage(sessionid, sortNum, result);
	}

	@Override
	public Map<String, Object> importResult(String sessionid) throws BusinessException {
		return getExcelBp().importResult(sessionid);
	}

	@Override
	public String importLeaveExl__RequiresNew(String sessionid, int sortNum) {
		return getExcelBp().importLeaveExl_Single(sessionid, sortNum);
	}

}
